# RUN: llvm-exegesis -mode=analysis -benchmarks-file=%s -analysis-clusters-output-file=- -analysis-clustering-epsilon=10 -analysis-numpoints=1 | FileCheck -check-prefixes=CHECK-CLUSTERS-ALL,CHECK-CLUSTERS-DBSCAN %s
# RUN: llvm-exegesis -mode=analysis -benchmarks-file=%s -analysis-clusters-output-file=- -analysis-clustering-epsilon=10 -analysis-numpoints=1 -analysis-clustering=dbscan | FileCheck -check-prefixes=CHECK-CLUSTERS-ALL,CHECK-CLUSTERS-DBSCAN %s
# RUN: llvm-exegesis -mode=analysis -benchmarks-file=%s -analysis-clusters-output-file=- -analysis-clustering-epsilon=10 -analysis-numpoints=1 -analysis-clustering=naive | FileCheck -check-prefixes=CHECK-CLUSTERS-ALL,CHECK-CLUSTERS-NAIVE %s

# Normally BSR32rr is in WriteBSR and BSF32rr is in WriteBSF sched classes.
# Here we check that if we have dbscan-clustered these two measurements into the
# same cluster, we don't split it per the sched classes into two.

# CHECK-CLUSTERS-ALL: {{^}}cluster_id,opcode_name,config,sched_class,inverse_throughput{{$}}

# CHECK-CLUSTERS-DBSCAN-NEXT: {{^}}0,
# CHECK-CLUSTERS-DBSCAN-SAME: ,4.03{{$}}
# CHECK-CLUSTERS-DBSCAN-NEXT: {{^}}0,
# CHECK-CLUSTERS-DBSCAN-SAME: ,3.02{{$}}

# CHECK-CLUSTERS-NAIVE-NEXT: {{^}}0,
# CHECK-CLUSTERS-NAIVE-SAME: ,3.02{{$}}
# CHECK-CLUSTERS-NAIVE: {{^}}1,
# CHECK-CLUSTERS-NAIVE-SAME: ,4.03{{$}}

---
mode:            inverse_throughput
key:
  instructions:
    - 'BSR32rr R11D EDI'
  config:          ''
  register_initial_values:
    - 'EDI=0x0'
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 1000000
measurements:
  - { key: inverse_throughput, value: 4.03048, per_snippet_value: 4.03048 }
error:           ''
info:            instruction has no tied variables picking Uses different from defs
assembled_snippet: BF00000000440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDF440FBDDFC3
...
---
mode:            inverse_throughput
key:
  instructions:
    - 'BSF32rr EAX R14D'
  config:          ''
  register_initial_values:
    - 'R14D=0x0'
cpu_name:        bdver2
llvm_triple:     x86_64-unknown-linux-gnu
num_repetitions: 1000000
measurements:
  - { key: inverse_throughput, value: 3.02186, per_snippet_value: 3.02186 }
error:           ''
info:            instruction has no tied variables picking Uses different from defs
assembled_snippet: 415641BE00000000410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6410FBCC6415EC3
...
